home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8043 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: colossus.holonet.net!russell
  2. From: russell@news.mdli.com (Russell Blackadar)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: More ?'s re: copy ctor
  5. Date: 13 Feb 1996 02:41:18 GMT
  6. Organization: HoloNet National Internet Access System: 510-704-1058/modem
  7. Message-ID: <4fotoe$nqe@colossus.holonet.net>
  8. References: <DMD0Kq.LHx@Virginia.EDU> <DMn8B8.yJ@Virginia.EDU>
  9. NNTP-Posting-Host: jubal.mdli.com
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Gregory Carl Lewin (gcl8a@Virginia.EDU) wrote:
  13. [...first part deleted... see my reply in other thread...]
  14.  
  15. : ...  However, if foo
  16. : is a member function of one of the classes, the error is not
  17. : given:
  18.  
  19. : Base2::foo(Base2* b) {...}
  20. : Derived::foo(Derived* d) {Base2::foo(d); ...}    //OK!
  21.  
  22. Quoting from the ARM, p. 36, "The standard conversion of a
  23. derived class pointer to one of its bases can be done only
  24. by a function that can access that class.  If the base is
  25. private, the function needs to be a friend or a member of
  26. a class that has the base as an immediate base class."
  27.  
  28. In other words, conversion from Derived12* to Base2* is
  29. automatic within a Base2 member function, which explains
  30. why you got no error message.
  31.  
  32. By the way, since your question is about pointers, it has 
  33. nothing whatever to do with copy ctors!
  34. --
  35. Russell Blackadar,   russell@mdli.com
  36.